<template>
  <view class="container">
    <view class="alert">回收站的绘本会一直保留，不会自动清空</view>
    <view class="group-title">
      <text class="group-label">小学必背古诗词</text>
      <view class="group-actions">
        <text class="restore-all" @click="restoreAll">还原</text>
        <text class="delete-all" @click="deleteAll">🗑</text>
      </view>
    </view>
    <view class="book-list">
      <view v-for="(item, idx) in books" :key="item.id" class="book-card" :style="{ borderColor: item.borderColor }">
        <view class="count-badge">{{ item.count }}本</view>
        <image :src="item.cover" class="cover" />
        <view class="grade">{{ item.grade }}</view>
        <view class="actions">
          <text class="restore" @click="restore(idx)">还原</text>
          <text class="delete-btn" @click="remove(idx)">🗑</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const books = ref([
  { id: 1, grade: '一年级', count: 14, cover: '/static/images/book1.svg', borderColor: '#222' },
  { id: 2, grade: '二年级', count: 15, cover: '/static/images/book2.svg', borderColor: '#2196f3' },
  { id: 3, grade: '三年级', count: 19, cover: '/static/images/book3.svg', borderColor: '#f44336' },
  { id: 4, grade: '四年级', count: 19, cover: '/static/images/book1.svg', borderColor: '#388e3c' },
  { id: 5, grade: '五年级', count: 22, cover: '/static/images/book2.svg', borderColor: '#ff9800' },
  { id: 6, grade: '六年级', count: 17, cover: '/static/images/book3.svg', borderColor: '#e91e63' }
])
function restore(idx: number) {
  // 还原逻辑
}
function remove(idx: number) {
  books.value.splice(idx, 1)
}
function restoreAll() {
  // 批量还原逻辑
}
function deleteAll() {
  books.value = []
}
</script>

<style scoped>
.container {
  background: #fff;
  min-height: 100vh;
  padding: 0 0 32rpx 0;
}
.alert {
  background: #ffeaea;
  color: #e53935;
  text-align: center;
  font-size: 26rpx;
  padding: 16rpx 0;
  margin-bottom: 12rpx;
}
.group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24rpx 8rpx 24rpx;
}
.group-label {
  color: #1976d2;
  font-size: 30rpx;
  font-weight: bold;
}
.group-actions {
  display: flex;
  align-items: center;
  gap: 16rpx;
}
.restore-all {
  color: #1976d2;
  font-size: 26rpx;
  cursor: pointer;
}
.delete-all {
  color: #888;
  font-size: 28rpx;
  cursor: pointer;
}
.book-list {
  display: flex;
  flex-wrap: wrap;
  padding: 0 16rpx;
  justify-content: space-between;
}
.book-card {
  width: calc((100% - 32rpx * 2) / 3);
  margin-bottom: 32rpx;
  background: #fff;
  border-radius: 12rpx;
  /* 移除边框 */
  box-shadow: 0 2rpx 8rpx #0001;
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 0;
}
.book-card:nth-child(6n) {
  margin-right: 0;
}
.count-badge {
  position: absolute;
  left: 8rpx;
  top: 8rpx;
  background: #222;
  color: #fff;
  font-size: 20rpx;
  padding: 2rpx 10rpx;
  border-radius: 6rpx;
  z-index: 2;
  font-weight: bold;
}
.cover {
  width: 100%;
  height: 120rpx;
  object-fit: cover;
  border-radius: 8rpx;
  margin-top: 32rpx;
}
.grade {
  margin-top: 8rpx;
  font-size: 26rpx;
  color: #222;
  font-weight: bold;
}
.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12rpx;
  margin-top: 8rpx;
  margin-bottom: 8rpx;
}
.restore {
  color: #1976d2;
  font-size: 24rpx;
  cursor: pointer;
}
.delete-btn {
  color: #888;
  font-size: 26rpx;
  cursor: pointer;
}
</style> 